home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 20 / Cream of the Crop 20 (Terry Blount) (1996).iso / program / vbprnt20.zip / VB3 / VBPRINT.BAS next >
BASIC Source File  |  1996-05-31  |  10KB  |  215 lines

  1. ' Examples for using the VBPRINT.DLL
  2. ' Written by Robert Simpson (Black Castle Software, LLC)
  3. ' Released to the public domain on 05/23/1996.
  4.  
  5. DefInt I
  6. DefLng L
  7. DefStr S
  8.  
  9. Option Explicit
  10.  
  11. ' Flags to use in the dmFields section of the VBDEVMODE
  12.  
  13. Global Const DM_IN_BUFFER = 8
  14. Global Const DM_IN_PROMPT = 4
  15. Global Const DM_OUT_BUFFER = 2
  16. Global Const DM_OUT_DEFAULT = 1
  17. Global Const DM_ORIENTATION = &H1
  18. Global Const DM_PAPERSIZE = &H2
  19. Global Const DM_PAPERLENGTH = &H4
  20. Global Const DM_PAPERWIDTH = &H8
  21. Global Const DM_SCALE = &H10
  22. Global Const DM_COPIES = &H100
  23. Global Const DM_DEFAULTSOURCE = &H200
  24. Global Const DM_PRINTQUALITY = &H400
  25. Global Const DM_COLOR = &H800
  26. Global Const DM_DUPLEX = &H1000
  27. Global Const DM_YRESOLUTION = &H2000
  28. Global Const DM_TTOPTION = &H4000
  29.  
  30. ' Here is the VB DEVMODE that should be used in all calls to this DLL requiring a DEVMODE structure:
  31.  
  32. Type DEVMODE_TYPE
  33.   dmDeviceName As String * 32
  34.   dmSpecVersion As Integer
  35.   dmDriverVersion As Integer
  36.   dmSize As Integer
  37.   dmDriverExtra As Integer
  38.   dmFields As Long
  39.   dmOrientation As Integer
  40.   dmPaperSize As Integer
  41.   dmPaperLength As Integer
  42.   dmPaperWidth As Integer
  43.   dmScale As Integer
  44.   dmCopies As Integer
  45.   dmDefaultSource As Integer
  46.   dmPrintQuality As Integer
  47.   dmColor As Integer
  48.   dmDuplex As Integer
  49.   dmYResolution As Integer
  50.   dmTTOption As Integer
  51.   dmPrivate As String
  52. End Type
  53.  
  54. '  The DEVMODE_TYPE structure in VB is essentially a base DEVMODE structure with a dynamic
  55. '  string attached to the end (the C version is directly below, named VBDEVMODE) which
  56. '  holds the printer's private data (if there is any).
  57.  
  58. Type BINNAMES_TYPE
  59.   sName As String * 24
  60. End Type
  61.  
  62. Type ENUMRESOLUTIONS_TYPE
  63.   xdpi As Long
  64.   ydpi As Long
  65. End Type
  66.  
  67. Type FILEDEPENDENCIES_TYPE
  68.   sFilename As String * 64
  69. End Type
  70.  
  71. Type PAPERNAMES_TYPE
  72.   sName As String * 64
  73. End Type
  74.  
  75. Type PAPERSIZE_TYPE
  76.   x As Integer
  77.   y As Integer
  78. End Type
  79.  
  80. Declare Function VBGetPrinters Lib "vbprint.dll" () As String
  81. Declare Function VBGetDriverFromName Lib "vbprint.dll" (printername As String) As String
  82. Declare Function VBSetDefPrinter Lib "vbprint.dll" (printername As String) As Integer
  83. Declare Function VBGetDefPrinter Lib "vbprint.dll" () As String
  84. Declare Function VBExtDeviceMode Lib "vbprint.dll" (ByVal hWnd As Integer, printername As String, inDEV As DEVMODE_TYPE, outDev As DEVMODE_TYPE, ByVal fMode As Integer) As Integer
  85. Declare Function VBDevModeToStr Lib "vbprint.dll" (inDEV As DEVMODE_TYPE) As String
  86. Declare Function VBStrToDevMode Lib "vbprint.dll" (dmString As String, outDev As DEVMODE_TYPE) As Integer
  87. Declare Function VBDeviceCapabilities Lib "vbprint.dll" (printername As String, ByVal iCap As Integer, lpStr As Any, inDEV As DEVMODE_TYPE) As Long
  88. Declare Function VBResetDC Lib "vbprint.dll" (ByVal hDC As Integer, outDev As DEVMODE_TYPE) As Integer
  89.  
  90. ' orientation selections
  91. Global Const DMORIENT_PORTRAIT = 1
  92. Global Const DMORIENT_LANDSCAPE = 2
  93.  
  94. ' paper selections
  95. '  Warning: The PostScript driver mistakingly uses DMPAPER_ values between
  96. ' *  50 and 56.  Don't use this range when defining new paper sizes.
  97.  
  98. Global Const DMPAPER_LETTER = 1               ' Letter 8 1/2 x 11 in
  99. Global Const DMPAPER_FIRST = DMPAPER_LETTER
  100. Global Const DMPAPER_LETTERSMALL = 2          ' Letter Small 8 1/2 x 11 in
  101. Global Const DMPAPER_TABLOID = 3              ' Tabloid 11 x 17 in
  102. Global Const DMPAPER_LEDGER = 4               ' Ledger 17 x 11 in
  103. Global Const DMPAPER_LEGAL = 5                ' Legal 8 1/2 x 14 in
  104. Global Const DMPAPER_STATEMENT = 6            ' Statement 5 1/2 x 8 1/2 in
  105. Global Const DMPAPER_EXECUTIVE = 7            ' Executive 7 1/4 x 10 1/2 in
  106. Global Const DMPAPER_A3 = 8                   ' A3 297 x 420 mm
  107. Global Const DMPAPER_A4 = 9                   ' A4 210 x 297 mm
  108. Global Const DMPAPER_A4SMALL = 10             ' A4 Small 210 x 297 mm
  109. Global Const DMPAPER_A5 = 11                  ' A5 148 x 210 mm
  110. Global Const DMPAPER_B4 = 12                  ' B4 250 x 354
  111. Global Const DMPAPER_B5 = 13                  ' B5 182 x 257 mm
  112. Global Const DMPAPER_FOLIO = 14               ' Folio 8 1/2 x 13 in
  113. Global Const DMPAPER_QUARTO = 15              ' Quarto 215 x 275 mm
  114. Global Const DMPAPER_10X14 = 16               ' 10x14 in
  115. Global Const DMPAPER_11X17 = 17               ' 11x17 in
  116. Global Const DMPAPER_NOTE = 18                ' Note 8 1/2 x 11 in
  117. Global Const DMPAPER_ENV_9 = 19               ' Envelope #9 3 7/8 x 8 7/8
  118. Global Const DMPAPER_ENV_10 = 20              ' Envelope #10 4 1/8 x 9 1/2
  119. Global Const DMPAPER_ENV_11 = 21              ' Envelope #11 4 1/2 x 10 3/8
  120. Global Const DMPAPER_ENV_12 = 22              ' Envelope #12 4 \276 x 11
  121. Global Const DMPAPER_ENV_14 = 23              ' Envelope #14 5 x 11 1/2
  122. Global Const DMPAPER_CSHEET = 24              ' C size sheet
  123. Global Const DMPAPER_DSHEET = 25              ' D size sheet
  124. Global Const DMPAPER_ESHEET = 26              ' E size sheet
  125. Global Const DMPAPER_ENV_DL = 27              ' Envelope DL 110 x 220mm
  126. Global Const DMPAPER_ENV_C5 = 28              ' Envelope C5 162 x 229 mm
  127. Global Const DMPAPER_ENV_C3 = 29              ' Envelope C3  324 x 458 mm
  128. Global Const DMPAPER_ENV_C4 = 30              ' Envelope C4  229 x 324 mm
  129. Global Const DMPAPER_ENV_C6 = 31              ' Envelope C6  114 x 162 mm
  130. Global Const DMPAPER_ENV_C65 = 32             ' Envelope C65 114 x 229 mm
  131. Global Const DMPAPER_ENV_B4 = 33              ' Envelope B4  250 x 353 mm
  132. Global Const DMPAPER_ENV_B5 = 34              ' Envelope B5  176 x 250 mm
  133. Global Const DMPAPER_ENV_B6 = 35              ' Envelope B6  176 x 125 mm
  134. Global Const DMPAPER_ENV_ITALY = 36           ' Envelope 110 x 230 mm
  135. Global Const DMPAPER_ENV_MONARCH = 37         ' Envelope Monarch 3.875 x 7.5 in
  136. Global Const DMPAPER_ENV_PERSONAL = 38        ' 6 3/4 Envelope 3 5/8 x 6 1/2 in
  137. Global Const DMPAPER_FANFOLD_US = 39          ' US Std Fanfold 14 7/8 x 11 in
  138. Global Const DMPAPER_FANFOLD_STD_GERMAN = 40  ' German Std Fanfold 8 1/2 x 12 in
  139. Global Const DMPAPER_FANFOLD_LGL_GERMAN = 41  ' German Legal Fanfold 8 1/2 x 13 in
  140. Global Const DMPAPER_LAST = DMPAPER_FANFOLD_LGL_GERMAN
  141. Global Const DMPAPER_USER = 256
  142.  
  143. ' bin selections
  144. Global Const DMBIN_UPPER = 1
  145. Global Const DMBIN_FIRST = DMBIN_UPPER
  146. Global Const DMBIN_ONLYONE = 1
  147. Global Const DMBIN_LOWER = 2
  148. Global Const DMBIN_MIDDLE = 3
  149. Global Const DMBIN_MANUAL = 4
  150. Global Const DMBIN_ENVELOPE = 5
  151. Global Const DMBIN_ENVMANUAL = 6
  152. Global Const DMBIN_AUTO = 7
  153. Global Const DMBIN_TRACTOR = 8
  154. Global Const DMBIN_SMALLFMT = 9
  155. Global Const DMBIN_LARGEFMT = 10
  156. Global Const DMBIN_LARGECAPACITY = 11
  157. Global Const DMBIN_CASSETTE = 14
  158. Global Const DMBIN_LAST = DMBIN_CASSETTE
  159. Global Const DMBIN_USER = 256             ' device specific bins start here
  160.  
  161. ' print qualities
  162. Global Const DMRES_DRAFT = -1
  163. Global Const DMRES_LOW = -2
  164. Global Const DMRES_MEDIUM = -3
  165. Global Const DMRES_HIGH = -4
  166.  
  167. ' color enable/disable for color printers
  168. Global Const DMCOLOR_MONOCHROME = 1
  169. Global Const DMCOLOR_COLOR = 2
  170.  
  171. ' duplex enable
  172. Global Const DMDUP_SIMPLEX = 1
  173. Global Const DMDUP_VERTICAL = 2
  174. Global Const DMDUP_HORIZONTAL = 3
  175.  
  176. ' TrueType options
  177. Global Const DMTT_BITMAP = 1          ' print TT fonts as graphics
  178. Global Const DMTT_DOWNLOAD = 2        ' download TT fonts as soft fonts
  179. Global Const DMTT_SUBDEV = 3          ' substitute device fonts for TT fonts
  180.  
  181. ' device capabilities indices
  182. Global Const DC_FIELDS = 1            ' Returns the dmFields member of the DEVMODE structure
  183. Global Const DC_PAPERS = 2            ' Reutrns an array of type Integer listing available paper sizes (see above DMPAPER consts)
  184. Global Const DC_PAPERSIZE = 3         ' Copys dims of all supported paper sizes (in 10ths of millimeters) to a PAPERSIZE_TYPE structure
  185. Global Const DC_MINEXTENT = 4         ' Returns a POINT_TYPE containing the min papersize that dmPaperLength and dmPaperWidth can specify
  186. Global Const DC_MAXEXTENT = 5         ' Returns a POINT_TYPE containing the max papersize that dmPaperLength and dmPaperWidth can specify
  187. Global Const DC_BINS = 6              ' Returns an arra